
package edu.zut.cs.software.example.group.service.impl;

import java.util.HashMap;
import java.util.List;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import edu.zut.cs.software.example.QueryInfo.QueryInfo;
import edu.zut.cs.software.example.group.dao.GroupDao;
import edu.zut.cs.software.example.group.domain.Group;
import edu.zut.cs.software.example.group.service.GroupManager;
import edu.zut.cs.software.example.service.impl.GenericManagerImpl;

@Service("groupManager")

@Transactional

public class GroupManagerImpl extends GenericManagerImpl<Group, Long> implements GroupManager {

	GroupDao groupDao;

	@Autowired
	public void setGroupDao(GroupDao groupDao) {
		this.groupDao = groupDao;
		this.dao = this.groupDao;
	}
	/**
	 * 获取信息
	 */
    @Override
	public HashMap<String,Object> getGroupsService() {
		List<Group> groups= groupDao.getGroups();
		HashMap<String,Object> data=new HashMap<>();
		data.put("data", groups);
		return data;
	}
    /**
     * 查询信息
     */
    @Override
	public HashMap<String,Object> searchByNameService(QueryInfo queryInfo) {
		List<Group> groupInfo= groupDao.searchByName(queryInfo.getQuery());
		HashMap<String,Object> data=new HashMap<>();
		data.put("data", groupInfo);
		return data;
	}

	@Override
	public Group echo(Group group) {
		// TODO Auto-generated method stub
		return null;
	}

}
